//
//  WPTabViewController.m
//  网易彩票
//
//  Created by zhoup on 16/5/29.
//  Copyright © 2016年 zhoup. All rights reserved.
//

#import "WPTabViewController.h"
#import "WPTabbar.h"

@interface WPTabViewController ()<WPTabbarDelegate>

@end

@implementation WPTabViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UINavigationController *profile = [self addController:@"Profile"];
    
    UINavigationController *arena = [self addController:@"Arena"];
   
    UINavigationController *discovery = [self addController:@"Discovery"];
   
    UINavigationController *hall = [self addController:@"Hall"];
   
    UINavigationController *history = [self addController:@"History"];
    
    self.viewControllers = @[hall,arena,discovery,history,profile];

    WPTabbar *tabbar = [[WPTabbar alloc]init];
    tabbar.frame = self.tabBar.bounds;
    tabbar.delegate = self;
    
    [self.tabBar addSubview:tabbar];
}

-(UINavigationController *)addController:(NSString *)sbName
{
    UIStoryboard *sb = [UIStoryboard storyboardWithName:sbName bundle:nil];
    
    UINavigationController *nav =  [sb instantiateInitialViewController];
    
    return nav;
}

#pragma mark - WPTabbarDelegate
-(void)tabbar:(WPTabbar *)tabbar from:(NSInteger)from to:(NSInteger)to
{
    self.selectedIndex = to;
}



@end
